<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><?php echo  Q::ini('appini/app_title')." ". Q::ini('appini/version');?></title>
<link href="css/default.css" rel="stylesheet" type="text/css">
<script src="js/jquery.js" type="text/javascript"></script>
<script language="javascript">
$().ready(function(){
	$("#username").focus();
	$("#frmLogin").submit(function(){
		if(chkdata()){
			$.ajax({
			   type: "POST",
			   dataTyp: "json",
			   data: $("#frmLogin").serialize(),
			   url: "<?=url('user/login')?>",
			   beforeSend: function(){
				   $("#result").html("正在登录..");
			   }, 
			   success: function(msg){
				  var msg = eval('('+msg+')');
				 
					if(msg.errorMsg =='ok'){
						$("#result").html("进入系统.."); 
						window.location.href=msg.url; 
					}
					else{
						$("#result").html(msg.errorMsg);	
					}
			   }
			}); 
		}
		return false;	
	});
});

function chkdata(){
	if($("#username").val() == ""){
    	alert("请输入您的登录帐号.");
		$("#user").focus();
		return false;
    }
	
	if($("#password").val()  == ""){
		alert("请输您的登录密码.");
		$("#password").focus();	
		return false;
	}
	
	return true;
}
</script>
</head>

<body style="background-color:#3D7EB4;">
<div id="container" style="margin:0 auto;width:100%;text-algin:center;" align="center">
<table width="1003" height="603" border="0" cellpadding="0" cellspacing="0" class="login" align="center">
  <tr>
    <td width="250" height="280" >&nbsp;</td>
  <td  >&nbsp;</td>
    <td  >&nbsp;</td>
  </tr>
  <tr>
    <td height="250"  >&nbsp;</td>
  <td  ><form action="<?=url('user/login')?>" method="post" name="frmLogin" id="frmLogin">
    <table width="100%" height="200"  border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="20">&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td width="190" align="right" class="blue">登录帐号&nbsp;&nbsp; </td>
        <td align="left"><input name="username" type="text" id="username" style="width:150px;"></td>
      </tr>
      <tr>
        <td align="right"><p class="blue">登录密码&nbsp;&nbsp;</p></td>
        <td align="left"><input name="password" type="password" id="password"  style="width:150px;"></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td align="left"><input name="login" type="image" id="login" src="images/btn_login.jpg" width="65" height="26" border="0">
            <a href="#"><img src="images/btn_reset.jpg" width="65" height="26" border="0"></a></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td align="left" valign="top"><div id="result" style="color:#F00"></div></td>
      </tr>
    </table>
  </form></td>
    <td >&nbsp;</td>
  </tr>
  <tr>
    <td >&nbsp;</td>
  <td >&nbsp;</td>
    <td  >&nbsp;</td>
  </tr>
</table>

</div>
</body>
</html>

